package Cantella::DJabberd::Model::Admin::User::Collection;

use Reaction::InterfaceModel::ObjectClass;
use Cantella::DJabberd::Model::Admin::User;
use Cantella::DJabberd::Model::Admin::User::Action::Create;
use Cantella::DJabberd::Model::Admin::User::Action::Login;
use Cantella::DJabberd::Model::Admin::User::Action::Logout;
use aliased 'Reaction::InterfaceModel::Collection::Virtual::ResultSet';

class Collection is ResultSet, which {

  has _parent => (
                  is  => 'ro',
                  isa => 'Cantella::DJabberd::Model::Admin',
                  weak_ref => 1,
                  handles  => [ qw(current_user has_current_user) ],
                 );

  has '+_source_resultset' => (handles => [qw/login_user logout_user/] );

#   implements login_user => as {
#     warn 'LOGIN USER ACTUALLY CALLED';
#     shift->_source_resultset->login_user(@_);
#   };

#   implements logout_user => as {
#     shift->_source_resultset->logout_user(@_);
#   };


#   implements '_build_member_type' =>
#     as { 'Cantella::DJabberd::Model::Admin::User' };

#   around '_default_action_args_for' => sub {
#     my $orig = shift;
#     my $tm   = $_[0]->_source_resultset;
#     $tm = $_[0]->_source_resultset if $_[1] eq 'Create';
#     return { %{ $orig->(@_) }, target_model => $tm };
#   };

};

1;
